package com.bw.day03.adapter

import android.widget.CheckBox
import android.widget.TextView
import com.bw.base.net.entity.Car
import com.bw.day03.R
import com.bw.day03.util.GlideUtlis
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class CarAdapter: BaseQuickAdapter<Car, BaseViewHolder>(R.layout.item_car) {
    override fun convert(
        holder: BaseViewHolder,
        item: Car
    ) {
        holder.getView<CheckBox>(R.id.car_cb).isChecked=item.isCheck

        GlideUtlis.loadCorner(context,item.image,holder.getView(R.id.car_img),10)
        holder.setText(R.id.car_storename,item.storeName)
        holder.setText(R.id.car_sku,"属性:${item.suk}")
        holder.setText(R.id.car_price,"¥${item.price}")
        holder.setText(R.id.car_num,"${item.cartNum}")
        if (item.cartNum==1){
            holder.getView<TextView>(R.id.car_sub).isEnabled=false
        }else{
            holder.getView<TextView>(R.id.car_sub).isEnabled=true
        }
    }
}